home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / Fonts.p < prev    next >
Text File  |  1995-09-12  |  8KB  |  303 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 6:13:35 PM }
  2. {
  3.      File:        Fonts.p
  4.  
  5.      Contains:    Font Manager Interfaces.
  6.  
  7.      Version:    Technology:    System 7.5
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT Fonts;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __FONTS__}
  26. {$SETC __FONTS__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34.  
  35. CONST
  36.     systemFont                    = 0;
  37.     applFont                    = 1;
  38.     newYork                        = 2;
  39.     geneva                        = 3;
  40.     monaco                        = 4;
  41.     venice                        = 5;
  42.     london                        = 6;
  43.     athens                        = 7;
  44.     sanFran                        = 8;
  45.     toronto                        = 9;
  46.     cairo                        = 11;
  47.     losAngeles                    = 12;
  48.     times                        = 20;
  49.     helvetica                    = 21;
  50.     courier                        = 22;
  51.     symbol                        = 23;
  52.     mobile                        = 24;
  53.     commandMark                    = 17;
  54.     checkMark                    = 18;
  55.     diamondMark                    = 19;
  56.  
  57.     appleMark                    = 20;
  58.     propFont                    = 36864;
  59.     prpFntH                        = 36865;
  60.     prpFntW                        = 36866;
  61.     prpFntHW                    = 36867;
  62.     fixedFont                    = 45056;
  63.     fxdFntH                        = 45057;
  64.     fxdFntW                        = 45058;
  65.     fxdFntHW                    = 45059;
  66.     fontWid                        = 44208;
  67.  
  68.  
  69. TYPE
  70.     FMInput = PACKED RECORD
  71.         family:                    INTEGER;
  72.         size:                    INTEGER;
  73.         face:                    Style;
  74.         needBits:                BOOLEAN;
  75.         device:                    INTEGER;
  76.         numer:                    Point;
  77.         denom:                    Point;
  78.     END;
  79.  
  80.     privateFontResult = Ptr;
  81.  
  82.     FMOutput = PACKED RECORD
  83.         errNum:                    INTEGER;
  84.         fontResult:                privateFontResult;
  85.         boldPixels:                UInt8;
  86.         italicPixels:            UInt8;
  87.         ulOffset:                UInt8;
  88.         ulShadow:                UInt8;
  89.         ulThick:                UInt8;
  90.         shadowPixels:            UInt8;
  91.         extra:                    SInt8;
  92.         ascent:                    UInt8;
  93.         descent:                UInt8;
  94.         widMax:                    UInt8;
  95.         leading:                SInt8;
  96.         curStyle:                SInt8;
  97.         numer:                    Point;
  98.         denom:                    Point;
  99.     END;
  100.  
  101.     FMOutPtr = ^FMOutput;
  102.  
  103.     FontRec = RECORD
  104.         fontType:                INTEGER;                                {font type}
  105.         firstChar:                INTEGER;                                {ASCII code of first character}
  106.         lastChar:                INTEGER;                                {ASCII code of last character}
  107.         widMax:                    INTEGER;                                {maximum character width}
  108.         kernMax:                INTEGER;                                {negative of maximum character kern}
  109.         nDescent:                INTEGER;                                {negative of descent}
  110.         fRectWidth:                INTEGER;                                {width of font rectangle}
  111.         fRectHeight:            INTEGER;                                {height of font rectangle}
  112.         owTLoc:                    INTEGER;                                {offset to offset/width table}
  113.         ascent:                    INTEGER;                                {ascent}
  114.         descent:                INTEGER;                                {descent}
  115.         leading:                INTEGER;                                {leading}
  116.         rowWords:                INTEGER;                                {row width of bit image / 2 }
  117.     END;
  118.  
  119.     FMetricRec = RECORD
  120.         ascent:                    Fixed;                                    {base line to top}
  121.         descent:                Fixed;                                    {base line to bottom}
  122.         leading:                Fixed;                                    {leading between lines}
  123.         widMax:                    Fixed;                                    {maximum character width}
  124.         wTabHandle:                Handle;                                    {handle to font width table}
  125.     END;
  126.  
  127.     FMetricRecPtr = ^FMetricRec;
  128.     FMetricRecHandle = ^FMetricRecPtr;
  129.  
  130.     WidEntry = RECORD
  131.         widStyle:                INTEGER;                                {style entry applies to}
  132.     END;
  133.  
  134.     WidTable = RECORD
  135.         numWidths:                INTEGER;                                {number of entries - 1}
  136.     END;
  137.  
  138.     AsscEntry = RECORD
  139.         fontSize:                INTEGER;
  140.         fontStyle:                INTEGER;
  141.         fontID:                    INTEGER;                                {font resource ID}
  142.     END;
  143.  
  144.     FontAssoc = RECORD
  145.         numAssoc:                INTEGER;                                {number of entries - 1}
  146.     END;
  147.  
  148.     StyleTable = RECORD
  149.         fontClass:                INTEGER;
  150.         offset:                    LONGINT;
  151.         reserved:                LONGINT;
  152.         indexes:                PACKED ARRAY [0..47] OF CHAR;
  153.     END;
  154.  
  155.     NameTable = RECORD
  156.         stringCount:            INTEGER;
  157.         baseFontName:            Str255;
  158.     END;
  159.  
  160.     KernPair = RECORD
  161.         kernFirst:                CHAR;                                    {1st character of kerned pair}
  162.         kernSecond:                CHAR;                                    {2nd character of kerned pair}
  163.         kernWidth:                INTEGER;                                {kerning in 1pt fixed format}
  164.     END;
  165.  
  166.     KernEntry = RECORD
  167.         kernStyle:                INTEGER;                                {style the entry applies to}
  168.         kernLength:                INTEGER;                                {length of this entry}
  169.     END;
  170.  
  171.     KernTable = RECORD
  172.         numKerns:                INTEGER;                                {number of kerning entries}
  173.     END;
  174.  
  175.     WidthTable = PACKED RECORD
  176.         tabData:                ARRAY [0..255] OF Fixed;                {character widths}
  177.         fontResult:                privateFontResult;                        {font record used to build table}
  178.         sExtra:                    LONGINT;                                {space extra used for table}
  179.         style:                    LONGINT;                                {extra due to style}
  180.         fID:                    INTEGER;                                {font family ID}
  181.         fSize:                    INTEGER;                                {font size request}
  182.         face:                    INTEGER;                                {style (face) request}
  183.         device:                    INTEGER;                                {device requested}
  184.         inNumer:                Point;                                    {scale factors requested}
  185.         inDenom:                Point;                                    {scale factors requested}
  186.         aFID:                    INTEGER;                                {actual font family ID for table}
  187.         fHand:                    Handle;                                    {family record used to build up table}
  188.         usedFam:                BOOLEAN;                                {used fixed point family widths}
  189.         aFace:                    UInt8;                                    {actual face produced}
  190.         vOutput:                INTEGER;                                {vertical scale output value}
  191.         hOutput:                INTEGER;                                {horizontal scale output value}
  192.         vFactor:                INTEGER;                                {vertical scale output value}
  193.         hFactor:                INTEGER;                                {horizontal scale output value}
  194.         aSize:                    INTEGER;                                {actual size of actual font used}
  195.         tabSize:                INTEGER;                                {total size of table}
  196.     END;
  197.  
  198.     FamRec = RECORD
  199.         ffFlags:                INTEGER;                                {flags for family}
  200.         ffFamID:                INTEGER;                                {family ID number}
  201.         ffFirstChar:            INTEGER;                                {ASCII code of 1st character}
  202.         ffLastChar:                INTEGER;                                {ASCII code of last character}
  203.         ffAscent:                INTEGER;                                {maximum ascent for 1pt font}
  204.         ffDescent:                INTEGER;                                {maximum descent for 1pt font}
  205.         ffLeading:                INTEGER;                                {maximum leading for 1pt font}
  206.         ffWidMax:                INTEGER;                                {maximum widMax for 1pt font}
  207.         ffWTabOff:                LONGINT;                                {offset to width table}
  208.         ffKernOff:                LONGINT;                                {offset to kerning table}
  209.         ffStylOff:                LONGINT;                                {offset to style mapping table}
  210.         ffProperty:                ARRAY [0..8] OF INTEGER;                {style property info}
  211.         ffIntl:                    ARRAY [0..1] OF INTEGER;                {for international use}
  212.         ffVersion:                INTEGER;                                {version number}
  213.     END;
  214.  
  215.  
  216. PROCEDURE InitFonts;
  217.     {$IFC NOT GENERATINGCFM}
  218.     INLINE $A8FE;
  219.     {$ENDC}
  220. PROCEDURE GetFontName(familyID: INTEGER; VAR name: Str255);
  221.     {$IFC NOT GENERATINGCFM}
  222.     INLINE $A8FF;
  223.     {$ENDC}
  224. PROCEDURE GetFNum(name: ConstStr255Param; VAR familyID: INTEGER);
  225.     {$IFC NOT GENERATINGCFM}
  226.     INLINE $A900;
  227.     {$ENDC}
  228. FUNCTION RealFont(fontNum: INTEGER; size: INTEGER): BOOLEAN;
  229.     {$IFC NOT GENERATINGCFM}
  230.     INLINE $A902;
  231.     {$ENDC}
  232. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  233.     {$IFC NOT GENERATINGCFM}
  234.     INLINE $A903;
  235.     {$ENDC}
  236. FUNCTION FMSwapFont({CONST}VAR inRec: FMInput): FMOutPtr;
  237.     {$IFC NOT GENERATINGCFM}
  238.     INLINE $A901;
  239.     {$ENDC}
  240. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  241.     {$IFC NOT GENERATINGCFM}
  242.     INLINE $A834;
  243.     {$ENDC}
  244. PROCEDURE FontMetrics(theMetrics: FMetricRecPtr);
  245.     {$IFC NOT GENERATINGCFM}
  246.     INLINE $A835;
  247.     {$ENDC}
  248. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  249.     {$IFC NOT GENERATINGCFM}
  250.     INLINE $A814;
  251.     {$ENDC}
  252. FUNCTION GetDefFontSize: INTEGER;
  253.     {$IFC NOT GENERATINGCFM}
  254.     INLINE $3EB8, $0BA8, $6604, $3EBC, $000C;
  255.     {$ENDC}
  256. FUNCTION IsOutline(numer: Point; denom: Point): BOOLEAN;
  257.     {$IFC NOT GENERATINGCFM}
  258.     INLINE $7000, $A854;
  259.     {$ENDC}
  260. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  261.     {$IFC NOT GENERATINGCFM}
  262.     INLINE $7001, $A854;
  263.     {$ENDC}
  264. FUNCTION GetOutlinePreferred: BOOLEAN;
  265.     {$IFC NOT GENERATINGCFM}
  266.     INLINE $7009, $A854;
  267.     {$ENDC}
  268. FUNCTION OutlineMetrics(byteCount: INTEGER; textPtr: UNIV Ptr; numer: Point; denom: Point; VAR yMax: INTEGER; VAR yMin: INTEGER; awArray: FixedPtr; lsbArray: FixedPtr; boundsArray: RectPtr): OSErr;
  269.     {$IFC NOT GENERATINGCFM}
  270.     INLINE $7008, $A854;
  271.     {$ENDC}
  272. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  273.     {$IFC NOT GENERATINGCFM}
  274.     INLINE $700A, $A854;
  275.     {$ENDC}
  276. FUNCTION GetPreserveGlyph: BOOLEAN;
  277.     {$IFC NOT GENERATINGCFM}
  278.     INLINE $700B, $A854;
  279.     {$ENDC}
  280. FUNCTION FlushFonts: OSErr;
  281.     {$IFC NOT GENERATINGCFM}
  282.     INLINE $700C, $A854;
  283.     {$ENDC}
  284. FUNCTION GetSysFont : INTEGER;
  285.     {$IFC NOT CFMSYSTEMCALLS}
  286.     INLINE $3EB8, $0BA6;            { MOVE.w $0BA6,(SP) }
  287.     {$ENDC}
  288.  
  289. FUNCTION GetAppFont : INTEGER;
  290.     {$IFC NOT CFMSYSTEMCALLS}
  291.     INLINE $3EB8, $0984;            { MOVE.w $0984,(SP) }
  292.     {$ENDC}
  293.  
  294.  
  295. { $ALIGN RESET}
  296. { $POP}
  297.  
  298. {$ENDC} {__FONTS__}
  299.  
  300.  IMPLEMENTATION
  301.  END.
  302.  
  303.